home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "File Renamer"
- ClientHeight = 5685
- ClientLeft = 720
- ClientTop = 705
- ClientWidth = 6585
- Height = 6090
- Icon = "Form1.frx":0000
- Left = 660
- LinkTopic = "Form1"
- ScaleHeight = 5685
- ScaleWidth = 6585
- Top = 360
- Width = 6705
- Begin VB.FileListBox File1
- Height = 4350
- Left = 2760
- TabIndex = 9
- Top = 120
- Width = 3735
- End
- Begin VB.DriveListBox Drive1
- Height = 315
- Left = 120
- TabIndex = 8
- Top = 120
- Width = 2535
- End
- Begin VB.DirListBox Dir1
- Height = 4590
- Left = 120
- TabIndex = 7
- Top = 480
- Width = 2535
- End
- Begin VB.TextBox txtNumberFrom
- Height = 285
- Left = 5280
- TabIndex = 2
- Text = "1"
- Top = 5040
- Width = 1215
- End
- Begin VB.CommandButton cmdGo
- Caption = "Go"
- Enabled = 0 'False
- Height = 615
- Left = 2760
- TabIndex = 3
- Top = 4680
- Width = 855
- End
- Begin VB.TextBox txtDirectory
- Enabled = 0 'False
- Height = 285
- Left = 120
- TabIndex = 0
- Text = "C:\"
- Top = 5400
- Width = 6375
- End
- Begin VB.TextBox txtPrefix
- Height = 285
- Left = 5280
- TabIndex = 1
- Text = "Pic_"
- Top = 4680
- Width = 1215
- End
- Begin VB.Label Label1
- Alignment = 1 'Right Justify
- Caption = "Number From"
- Height = 255
- Index = 2
- Left = 3720
- TabIndex = 6
- Top = 5040
- Width = 1455
- End
- Begin VB.Label Label1
- Alignment = 1 'Right Justify
- Caption = "File Name Prefix"
- Height = 255
- Index = 1
- Left = 3720
- TabIndex = 5
- Top = 4680
- Width = 1470
- End
- Begin VB.Label Label1
- Caption = "Full Path"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 4
- Top = 5160
- Width = 750
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdGo_Click()
- Dim directory As String
- Dim filename As String
- Dim filenames As New Collection
- Dim prefix As String
- Dim i As Integer
- Dim Index As Integer
- Dim pos As Integer
- Dim extension As String
- Dim new_name As String
- MousePointer = vbHourglass
- directory = Trim$(txtDirectory.Text)
- If Right$(directory, 1) <> "\" Then _
- directory = directory & "\"
- ' Get the file names.
- filename = Dir(directory & "*.*")
- Do While filename <> ""
- filenames.Add filename
- filename = Dir
- Loop
- ' Rename the files.
- Index = CInt(txtNumberFrom.Text)
- prefix = Trim$(txtPrefix.Text)
- For i = 1 To filenames.Count
- filename = filenames(i)
- pos = InStr(filename, ".")
- If pos > 0 Then
- extension = Right$(filename, Len(filename) - pos + 1)
- Else
- extension = ""
- End If
- Name directory & filename As _
- directory & prefix & _
- Format$(Index) & extension
- Index = Index + 1
- Next i
- MousePointer = vbDefault
- MsgBox "Moved" & Str$(filenames.Count) & " files."
- File1.Refresh
- End Sub
- Private Sub Dir1_Change()
- File1.Path = Dir1
- txtDirectory = Dir1
- cmdGo.Enabled = True
- If txtDirectory = "c:\" Or txtDirectory = "c:\WINDOWS" Then
- cmdGo.Enabled = False
- End If
- End Sub
- Private Sub Drive1_Change()
- Dir1.Path = Drive1
- txtDirectory = Dir1
- End Sub
- Private Sub Form_Load()
- Drive1 = "C:\"
- cmdGo.Enabled = False
- End Sub
-